<?php
defined('OA_LIB_PATH') || define('OA_LIB_PATH', '/opt/op/OALib');
defined('OPEN_LIB_PATH') || define('OPEN_LIB_PATH', '/opt/op/OpenLib');

require_once 'PHPUnit/Framework.php';
require_once 'Log.php';
require_once OPEN_LIB_PATH . '/open/models/OaOperatingDataModel.php';

class OaOperatingDataModelTest extends PHPUnit_Framework_TestCase
{
    private $_logger;
    private $_model;
    
    protected function setUp()
    {
        $logger = Log::factory('console', '', '', array(), PEAR_LOG_DEBUG);
        $this->_logger = $logger;
        $this->_model = new OaOperatingDataModel($logger);
    }
    
    protected function tearDown()
    {
        
    }
    
    public function testGetRegLoginDataByArea()
    {
        $this->markTestSkipped();
        $result = $this->_model->getRegLoginDataByArea('2010-01-01', '2010-04-26', 50834, 0, 5);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
        $result = $this->_model->getRegLoginDataByAreaCount('2010-01-01', '2010-04-26', 50834);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue($result !== false);
    }
    
    public function testGetRegLoginDataByApp()
    {
        $this->markTestSkipped();
        $result = $this->_model->getRegLoginDataByApp('2010-01-01', '2010-04-26', 50831, 0, 5);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
    }
    
    public function testGetEkeyDataByApp()
    {
        $this->markTestSkipped();
        $result = $this->_model->getEkeyDataByApp('2010-01-01', '2010-04-26', 50834, 0, 5);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
    }
    
    public function testGetOneAccountMultiAreaDataByApp()
    {
        $this->markTestSkipped();
        $result = $this->_model->getOneAccountMultiAreaDataByApp('2010-01-01', '2010-04-26', 50834, 0, 5);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
    }
    
    public function testGetConsumeDataByApp()
    {
        $this->markTestSkipped();
        $result = $this->_model->getConsumeDataByArea('2010-01-01', '2010-04-26', 50834, 0, 5);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
    }
    
    public function testGetPayDataByApp()
    {
        $this->markTestSkipped();
        $result = $this->_model->getPayDataByArea('2010-03-02', '2010-03-02', 50831, 0, 5);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
    }
    
    public function testGetIncomeDataByApp()
    {
//        $this->markTestSkipped();
        $result = $this->_model->getIncomeDataByArea('2010-01-13', '2010-01-13', 200041500, 0, 5);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $result = $this->_model->getIncomeDataByArea('2010-01-13', '2010-01-13', 200041500, 0, 5, 1);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
    }
    
    public function testGetBonusDataByApp()
    {
        $this->markTestSkipped();
        $result = $this->_model->getBonusDataByApp('2010-01-01', '2010-03-02', 50831, 0, 5);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
    }
    
    public function testGetPointsDataByApp()
    {
        $this->markTestSkipped();
        $result = $this->_model->getPointsDataByArea('2010-01-01', '2010-01-06', 50831, 0, 5);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
    }
    
    public function testGetHelpDataByApp()
    {
        $this->markTestSkipped();
        $result = $this->_model->getHelpDataByApp('2010-01-01', '2010-03-02', 50831, 0, 5);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
    }
    
    public function testGetHelpQuestionDataByApp()
    {
        $this->markTestSkipped();
        $result = $this->_model->getHelpQuestionDataByApp('2010-01-01', '2010-03-02', 50831, 0, 5);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
    }
    
    public function testGetDataByTable()
    {
        $this->markTestSkipped();
        $result = $this->_model->getDataByTable('tbsppayloghis', 0, 100);
        $this->_logger->log($result, PEAR_LOG_DEBUG);
        $this->assertTrue(is_array($result));
    }
}